package com.huaqin.develop.demotest.controller;

import com.huaqin.develop.demotest.pojo.WmsPurchaseDto;
import org.apache.rocketmq.spring.core.RocketMQTemplate;

import javax.annotation.PostConstruct;
import java.util.Date;


public class Producer {
    // 自动注入 RocketMQTemplate模板类，用于生产消息
    RocketMQTemplate mqTemplate = null;

    @PostConstruct
    public void init() {
        mqTemplate = new RocketMQTemplate();
    }


    public void send() {
        mqTemplate = new RocketMQTemplate();

        WmsPurchaseDto params = new WmsPurchaseDto(new Date().getTime(), "测试");
        mqTemplate.convertAndSend("fourbrothertopic", params);
    }

    public static void main(String[] args) {
        new Producer().send();


    }
    // 提供接口路由，传入消息体，


}
